package com.ruoyi.order.service.impl;

import com.ruoyi.order.domain.OrderInfo;
import com.ruoyi.order.mapper.OrderInfoMapper;
import com.ruoyi.order.service.OrderRemoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class OrderRemoteServiceImpl implements OrderRemoteService {


    @Autowired
    private OrderInfoMapper orderInfoMapper;

    @Override
    @Transactional
    public String createOrder(String userId) {
        System.out.println("OrderRemoteServiceImpl 收到请求，userId: " + userId);
        OrderInfo order = new OrderInfo();
        order.setUserId(Long.valueOf(userId));
        order.setGoodsId(1001L); // 假设与上面对应
        order.setStatus(0);
        orderInfoMapper.insert(order);


        return "订单创建成功 for user " + userId;
    }
}
